using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;

namespace TF.Access {
	public partial class TF_EventRestaurant {
		#region Fields
		private int iD;
		private int eventLineId;
		private int eventId;
		private int restaurantId;
		private int cityID;
		private decimal retaurantPrice;
		private string startDate;
		private string startTime;
		private string endDate;
		private string endTime;
		private string remark;
		private string contactPerson;
		private string contactTelephone;
		private int lanuageId;
		private int scheduleStatus;
		private int stepDay;
		private string locCode;
		#endregion
		
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the TF_EventRestaurant class.
		/// </summary>
		public TF_EventRestaurant() {
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_EventRestaurant class.
		/// </summary>
		public TF_EventRestaurant(int eventLineId, int eventId, int restaurantId, int cityID, decimal retaurantPrice, string startDate, string startTime, string endDate, string endTime, string remark, string contactPerson, string contactTelephone, int lanuageId, int scheduleStatus, int stepDay, string locCode) {
			this.eventLineId = eventLineId;
			this.eventId = eventId;
			this.restaurantId = restaurantId;
			this.cityID = cityID;
			this.retaurantPrice = retaurantPrice;
			this.startDate = startDate;
			this.startTime = startTime;
			this.endDate = endDate;
			this.endTime = endTime;
			this.remark = remark;
			this.contactPerson = contactPerson;
			this.contactTelephone = contactTelephone;
			this.lanuageId = lanuageId;
			this.scheduleStatus = scheduleStatus;
			this.stepDay = stepDay;
			this.locCode = locCode;
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_EventRestaurant class.
		/// </summary>
		public TF_EventRestaurant(int iD, int eventLineId, int eventId, int restaurantId, int cityID, decimal retaurantPrice, string startDate, string startTime, string endDate, string endTime, string remark, string contactPerson, string contactTelephone, int lanuageId, int scheduleStatus, int stepDay, string locCode) {
			this.iD = iD;
			this.eventLineId = eventLineId;
			this.eventId = eventId;
			this.restaurantId = restaurantId;
			this.cityID = cityID;
			this.retaurantPrice = retaurantPrice;
			this.startDate = startDate;
			this.startTime = startTime;
			this.endDate = endDate;
			this.endTime = endTime;
			this.remark = remark;
			this.contactPerson = contactPerson;
			this.contactTelephone = contactTelephone;
			this.lanuageId = lanuageId;
			this.scheduleStatus = scheduleStatus;
			this.stepDay = stepDay;
			this.locCode = locCode;
		}
		#endregion
		
		#region Properties
		/// <summary>
		/// Gets or sets the ID value.
		/// </summary>
		public int ID {
			get { return iD; }
			set { iD = value; }
		}
		
		/// <summary>
		/// Gets or sets the EventLineId value.
		/// </summary>
		public int EventLineId {
			get { return eventLineId; }
			set { eventLineId = value; }
		}
		
		/// <summary>
		/// Gets or sets the EventId value.
		/// </summary>
		public int EventId {
			get { return eventId; }
			set { eventId = value; }
		}
		
		/// <summary>
		/// Gets or sets the RestaurantId value.
		/// </summary>
		public int RestaurantId {
			get { return restaurantId; }
			set { restaurantId = value; }
		}
		
		/// <summary>
		/// Gets or sets the CityID value.
		/// </summary>
		public int CityID {
			get { return cityID; }
			set { cityID = value; }
		}
		
		/// <summary>
		/// Gets or sets the RetaurantPrice value.
		/// </summary>
		public decimal RetaurantPrice {
			get { return retaurantPrice; }
			set { retaurantPrice = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartDate value.
		/// </summary>
		public string StartDate {
			get { return startDate; }
			set { startDate = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartTime value.
		/// </summary>
		public string StartTime {
			get { return startTime; }
			set { startTime = value; }
		}
		
		/// <summary>
		/// Gets or sets the EndDate value.
		/// </summary>
		public string EndDate {
			get { return endDate; }
			set { endDate = value; }
		}
		
		/// <summary>
		/// Gets or sets the EndTime value.
		/// </summary>
		public string EndTime {
			get { return endTime; }
			set { endTime = value; }
		}
		
		/// <summary>
		/// Gets or sets the Remark value.
		/// </summary>
		public string Remark {
			get { return remark; }
			set { remark = value; }
		}
		
		/// <summary>
		/// Gets or sets the ContactPerson value.
		/// </summary>
		public string ContactPerson {
			get { return contactPerson; }
			set { contactPerson = value; }
		}
		
		/// <summary>
		/// Gets or sets the ContactTelephone value.
		/// </summary>
		public string ContactTelephone {
			get { return contactTelephone; }
			set { contactTelephone = value; }
		}
		
		/// <summary>
		/// Gets or sets the LanuageId value.
		/// </summary>
		public int LanuageId {
			get { return lanuageId; }
			set { lanuageId = value; }
		}
		
		/// <summary>
		/// Gets or sets the ScheduleStatus value.
		/// </summary>
		public int ScheduleStatus {
			get { return scheduleStatus; }
			set { scheduleStatus = value; }
		}
		
		/// <summary>
		/// Gets or sets the StepDay value.
		/// </summary>
		public int StepDay {
			get { return stepDay; }
			set { stepDay = value; }
		}
		
		/// <summary>
		/// Gets or sets the LocCode value.
		/// </summary>
		public string LocCode {
			get { return locCode; }
			set { locCode = value; }
		}
		#endregion
		
		#region Methods
		/// <summary>
		/// Saves a record to the TF_EventRestaurant table.
		/// </summary>
		public void Insert() {
			iD = Convert.ToInt32(SqlClientUtility.ExecuteScalar("TF_EventRestaurantInsert", eventLineId, eventId, restaurantId, cityID, retaurantPrice, startDate, startTime, endDate, endTime, remark, contactPerson, contactTelephone, lanuageId, scheduleStatus, stepDay, locCode));
		}
		
		/// <summary>
		/// Updates a record in the TF_EventRestaurant table.
		/// </summary>
		public void Update() {
			SqlClientUtility.ExecuteNonQuery("TF_EventRestaurantUpdate", iD, eventLineId, eventId, restaurantId, cityID, retaurantPrice, startDate, startTime, endDate, endTime, remark, contactPerson, contactTelephone, lanuageId, scheduleStatus, stepDay, locCode);
		}
		
		/// <summary>
		/// Deletes a record from the TF_EventRestaurant table by its primary key.
		/// </summary>
		public void Delete() {
			SqlClientUtility.ExecuteNonQuery("TF_EventRestaurantDelete", iD);
		}
		
		/// <summary>
		/// Selects a single record from the TF_EventRestaurant table.
		/// </summary>
		public static TF_EventRestaurant Select(int iD) {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_EventRestaurantSelect", iD)) {
				if (dataReader.Read()) {
					return MakeTF_EventRestaurant(dataReader);
				} else {
					return null;
				}
			}
		}
		
		/// <summary>
		/// Selects all records from the TF_EventRestaurant table.
		/// </summary>
		public static List<TF_EventRestaurant> SelectAll() {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_EventRestaurantSelectAll")) {
				List<TF_EventRestaurant> tF_EventRestaurantList = new List<TF_EventRestaurant>();
				while (dataReader.Read()) {
					TF_EventRestaurant tF_EventRestaurant = MakeTF_EventRestaurant(dataReader);
					tF_EventRestaurantList.Add(tF_EventRestaurant);
				}
				return tF_EventRestaurantList;
			}
		}
		
		/// <summary>
		/// Creates a new instance of the TF_EventRestaurant class and populates it with data from the specified SqlDataReader.
		/// </summary>
		private static TF_EventRestaurant MakeTF_EventRestaurant(SqlDataReader dataReader) {
			TF_EventRestaurant tF_EventRestaurant = new TF_EventRestaurant();
			
			if (dataReader.IsDBNull(0) == false) {
				tF_EventRestaurant.ID = dataReader.GetInt32(0);
			}
			if (dataReader.IsDBNull(1) == false) {
				tF_EventRestaurant.EventLineId = dataReader.GetInt32(1);
			}
			if (dataReader.IsDBNull(2) == false) {
				tF_EventRestaurant.EventId = dataReader.GetInt32(2);
			}
			if (dataReader.IsDBNull(3) == false) {
				tF_EventRestaurant.RestaurantId = dataReader.GetInt32(3);
			}
			if (dataReader.IsDBNull(4) == false) {
				tF_EventRestaurant.CityID = dataReader.GetInt32(4);
			}
			if (dataReader.IsDBNull(5) == false) {
				tF_EventRestaurant.RetaurantPrice = dataReader.GetDecimal(5);
			}
			if (dataReader.IsDBNull(6) == false) {
				tF_EventRestaurant.StartDate = dataReader.GetString(6);
			}
			if (dataReader.IsDBNull(7) == false) {
				tF_EventRestaurant.StartTime = dataReader.GetString(7);
			}
			if (dataReader.IsDBNull(8) == false) {
				tF_EventRestaurant.EndDate = dataReader.GetString(8);
			}
			if (dataReader.IsDBNull(9) == false) {
				tF_EventRestaurant.EndTime = dataReader.GetString(9);
			}
			if (dataReader.IsDBNull(10) == false) {
				tF_EventRestaurant.Remark = dataReader.GetString(10);
			}
			if (dataReader.IsDBNull(11) == false) {
				tF_EventRestaurant.ContactPerson = dataReader.GetString(11);
			}
			if (dataReader.IsDBNull(12) == false) {
				tF_EventRestaurant.ContactTelephone = dataReader.GetString(12);
			}
			if (dataReader.IsDBNull(13) == false) {
				tF_EventRestaurant.LanuageId = dataReader.GetInt32(13);
			}
			if (dataReader.IsDBNull(14) == false) {
				tF_EventRestaurant.ScheduleStatus = dataReader.GetInt32(14);
			}
			if (dataReader.IsDBNull(15) == false) {
				tF_EventRestaurant.StepDay = dataReader.GetInt32(15);
			}
			if (dataReader.IsDBNull(16) == false) {
				tF_EventRestaurant.LocCode = dataReader.GetString(16);
			}

			return tF_EventRestaurant;
		}
		#endregion
	}
}
